package springboot.service;

import springboot.Interface.serviceInterface.ReportRepairManagementServiceInterface;
import springboot.dao.ReportRepairDao;
import springboot.domain.ReportRepair;
import springboot.domain.StudentReportRepair;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Collection;

@Service
public class ReportRepairService implements ReportRepairManagementServiceInterface {
    @Autowired
    private ReportRepairDao reportRepairDao;
    @Override
    //查找所有宿管已批准的报修申请
    public Collection<ReportRepair> findAll(int pageNo, int pageSize){
        return reportRepairDao.findAll(pageNo, pageSize);
    }
    @Override
    //根据宿舍楼查找宿管已批准的报修申请
    public Collection<ReportRepair> find(String dorm){
        return reportRepairDao.find(dorm);
    }
    @Override
    //查找需要宿管批准的学生报修申请
    public Collection<StudentReportRepair> checkReport(int pageNo, int pageSize){
        return reportRepairDao.checkReport(pageNo, pageSize);
    }
    @Override
    //学生提交报修申请
    public boolean studentReportRepair(StudentReportRepair studentReportRepair){
        return reportRepairDao.studentReportRepair(studentReportRepair);
    }
    @Override
    //宿管同意批准学生的报修申请
    public boolean managerAgreeReportRepair(StudentReportRepair studentReportRepair){
        return reportRepairDao.managerAgreeReportRepair(studentReportRepair);
    }
    @Override
    public boolean managerDisAgreeReportRepair(StudentReportRepair studentReportRepair){
        return reportRepairDao.managerDisAgreeReportRepair(studentReportRepair);
    }
    @Override
    //删除学生提交的不合格的报修申请
    public boolean deleteStudentReportRepair(int id){
        return reportRepairDao.deleteStudentReportRepair(id);
    }

    @Override
    //增加一条报修申请数据
    public boolean add(ReportRepair reportRepair){
        return reportRepairDao.add(reportRepair);
    }
    @Override
    //删除一条报修申请数据
    public boolean delete(int id){
        return reportRepairDao.delete(id);
    }
    @Override
    //修改一条报修申请数据
    public boolean update(ReportRepair reportRepair) {
        return reportRepairDao.update(reportRepair);
    }
}
